#include "widget.h"
#include "ui_widget.h"

#include <QFile>
#include <QDir>
#include <QDebug>


Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);

//    //ui->label->setStyleSheet("background-color: black;");
//    QString fileName ="myFile.txt";// 文件名
//    QString currentPath = QDir::currentPath();//当前路径
//    QString str = currentPath+"/"+fileName;
//    qDebug() <<  str;

//    QFile file(currentPath+"/"+fileName);//文件路径
//    if(!file.open(QIODevice::WriteOnly | QIODevice::Text))
//    {
//        qDebug() << "open error";
//        return;
//    }

//    file.write("Hello world"); file.close();
//    return ;


}

Widget::~Widget()
{
    delete ui;
}


void Widget::on_pushButton_clicked()
{
    ui->lineEdit->setText("这是按钮1");

    if(ui->pushButton_2->isEnabled())
    {
        ui->pushButton_2->setEnabled(false);
    }
    else
    {
        ui->pushButton_2->setEnabled(true);
    }

    setWindowTitle("123");

    setWindowIcon(QIcon(":/a.png"));

}


void Widget::on_pushButton_2_clicked()
{
     ui->lineEdit->setText("这是按钮2");

     QRect rect = geometry();
     qDebug() << rect;

     QRect rect2 = frameGeometry();
     qDebug() << rect2;

}






